<?php 
/**
 * @package EPass
 * @author Oliver Leisalu
 */
session_start();
require('Epass.class.php');
require('EpassResponse.class.php');

// direct user to epass
if( $_POST['login'] ) {

	Epass::sendToEpass( 'sample-conf.php' );
	
// handle replay
} else if( $_POST ) {

	$response = Epass::handleReplay( 'sample-conf.php' );

	if( $response->isSuccessful )
		echo '<h3>Username: '.$response->username.', fullname: '.$response->name.'</h3><br />';
	else
	 	echo '<h3>Login failed! (error code: '.$response->errorCode.')</h3>';
}
?>
<form name="form" action="" method="post">
	<input type="submit" name="login" value="Login">
</form>